package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.maintenancesystem.basisinfo;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.maintenancesystem.basisinfo.AlarmService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * @Author: YangYu
 * @ClassName: AlarmController
 * @Date: Created in 14:06 2021/6/17
 * @Description: 报警
 */
@Action
@RequestMapping(value="alarmInfo")
public class AlarmController extends BaseController {

    @Resource
    public AlarmService alarmService;

    /**
     * @Author YangYu
     * @Description 报警日志分页列表
     * @Date Created in 14:17 2020/12/22
     * @Param [jsonParam]
     */

    @At(value = "alarmLogPagList", method = RequestMethod.GET, param = {"page", "limit"})
    public RespEntity alarmLogPagList(@RequestBody(required = false) JSONObject jsonParam) {
        return alarmService.alarmLogPagList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 报警日志列表(前5条)
     * @Date Created in 14:17 2020/12/22
     * @Param [jsonParam]
     */

    @At(value = "alarmLogList", method = RequestMethod.GET)
    public RespEntity alarmLogList(@RequestBody(required = false) JSONObject jsonParam) {
        return alarmService.alarmLogList(jsonParam);
    }

    /**
     * 前端是否对这个用户做报警处理
     * @param
     *
     * @return
     */
    @At(value = "isAlarm", method = RequestMethod.GET)
    public RespEntity isAlarm(@RequestBody(required = false) JSONObject jsonParam) {
        return alarmService.isAlarm(jsonParam);
    }
}
